package handler

import (
	"web_framework/model"
	"web_framework/pkg/constvar"
	"web_framework/pkg/e"
)

//8.1	设置下载分区
type SetPartitionHandle struct {
}

func (setPartitionHandle SetPartitionHandle) handleMsg(data model.Request, clientId string) (result model.Response) {
	if data.Mtype == constvar.MTypeSetPartitionRequest {
		//检查参数是否为空
		if len(data.Data.Sn) == 0 || len(data.Data.UUID) == 0 {
			e.Log("Info", "SN/UUID参数异常")
			return ReturnErr(data.Mid, constvar.MTypeSetPartitionResponse, "SN/UUID参数异常")
		}

		return model.Response{
			Mid:    data.Mid,
			Mtype:  constvar.MTypeSetPartitionResponse,
			Status: 1,
		}
	}
	e.Log("Info", "设置下载分区失败")
	return ReturnErr(data.Mid, constvar.MTypeSetPartitionResponse, "设置下载分区失败")
}
